<!DOCTYPE html>
<html>
<head>
    <title>机构选择</title>
    <meta charset="utf-8">
    <!-- 指定以IE8的方式来渲染 -->
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="/css/jsherp.css"/>
    <script type="text/javascript" src="/js/jquery-1.8.0.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/js/easyui/themes/gray/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="/js/easyui/themes/icon.css"/>
    <link type="text/css" rel="stylesheet" href="/css/common.css"/>
    <script type="text/javascript" src="/js/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/js/common/common.js"></script>
</head>
<body>
<!-- 数据显示table -->
<div>
    <ul id="ttForSelect"></ul>
</div>

<script type="text/javascript">

    $(function () {
        $('#ttForSelect').tree({
            url: '/user/getOrganizationUserTree',
            animate: true,
            onDblClick: function (node) {
                //双击修改
                forSelectUser(node);
            }
        });

        function forSelectUser(node) {
            var selectType=$("#selectType").val();
            console.log(node);
            if(!node.attributes.type){
                return;
            }
            if(selectType=='principal'){
                $("#principalName").textbox("setValue", node.text);
                $("#principal").val(node.id);
            }else if(selectType=='org'){
                $("#orgAbr").val(node.text);
                $("#orgaId").val(node.id);
            }
            $('#forSelectUserDlg').dialog('close');
        }
    });

</script>
</body>
</html>